package com.mall.shopping.services;

import com.mall.shopping.ITestProductDetailService;
import com.mall.shopping.converter.ITestProductDetailConverter;
import com.mall.shopping.dal.entitys.Item;
import com.mall.shopping.dal.persistence.ItemMapper;
import com.mall.shopping.dto.ITestProductDetailDto;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;

@Service
public class ITestProductDetailServiceImpl implements ITestProductDetailService {

    @Autowired
    ItemMapper itemMapper;

    @Autowired
    ITestProductDetailConverter productDetailConverter;

    @Override
    public ITestProductDetailDto getProductDetail(Long productId) {
        Item item = itemMapper.selectByPrimaryKey(productId);

        // 对象转化
        ITestProductDetailDto iTestProductDetailDto = productDetailConverter.productDetailDoToDto(item);
        return iTestProductDetailDto;
    }
}
